<?php
/*
Модуль "Меню Новостей".
*/
	$article_limit = 7;
	$sql = 'SELECT * FROM '.DB::$tables['articles'].
		' WHERE `articles_category`="news" AND `articles_publicated`="1" ORDER BY `articles_crt_date` DESC LIMIT '.$article_limit;
	$article = exec_sql2array($sql); //myPrint( $article, '$article'); 
	$article_li='';
	$article_div=''; 	
	foreach($article as $arr){
			preg_match_all('/\d*/', $arr['articles_crt_date'], $mtch); 
			$article_date = $mtch[0][4].'.'.$mtch[0][2].'.'.$mtch[0][0];
			$article_text = $arr['articles_text'];
			$cut_pos = strpos( $article_text, '<cut>');
			if( $cut_pos ){
				$article_text = substr( $article_text, 0, $cut_pos ).
				'<a href="'.$_SERVER['REQUEST_URI'].'/'.$arr['articles_id'].'">'.'читать далее...'.'</a>';
			}
		$article_li.='<li><a href="#news_'.$arr['articles_id'].'" class="active">'.$arr['articles_title'].'</a></li>'."\n";
		$article_div.='<div id="news_'.$arr['articles_id'].'" class="main_info"><a name="news_'.$arr['articles_id'].'"></a>'."\n".
		'<h2>'.'<i class="simple">'.$article_date.'</i>'.' '.$arr['articles_title'].'</h2>'."\n".
		$article_text."\n".'</div>'."\n";
	}
	if($article_div==''){
		$article_li='Новостей пока нет...';
		$article_div='<h2>Новостей пока нет...</h2>'; 
	}
	
/*
<div id="news_15102012" class="main_info"><a name="news_15102012"></a>	
	<h2>15.10.2012 Новость.</h2>
	<p>
		<a rel="prettyPhoto[gallery_1]" href="upload/images/IMG_1909.jpg" title="Здорово, когда есть надежный тыл"><img class="img_thumb" src="upload/images/IMG_1909.jpg" alt="Сотрудники SPECTRUM"></a>
		Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
	</p>
</div>
*/	
?>
<div id="container">
	<div id="content">			
		<div id="infoblock_wrapper" class="block main_b shadow dynamic_">
<?php echo $article_div;?>
		</div><!-- infoblock_wrapper main_b-->
	</div><!-- #content-->
</div><!-- #container-->

<div class="sidebar" id="sideLeft">

	<div class="block left_b shadow">
		<div class="left_info">
			<ul class="left_menu dynamic">
<?php echo $article_li;//<li><a href="#news_22092012" class="active">22.09.2012</a></li> ?>
			</ul>
		</div>				
	 </div><!-- left_b-->
	 
	 <div class="block left_b shadow">
		<div class="left_info">
<? 
CoreModule::includeTemplate( array('template_name'=>'FeedbackForm.template.php','template_path'=>'/templates/spectrum' ) );
?>
		</div>
	 </div>

</div><!-- .sidebar#sideLeft -->